﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Temapb1_ip
{
    class Lista_Masini
    {
        private static Lista_Masini instance;
        private List<Masina> masini;

        public Masina get_masina(int index)
        {
            return masini[index];
        }

        public void set_masina(Masina m)
        {
            masini.Add(m);
            /*
            if (model == 1)
                masini[index] = new Sedan();
            else
                if (model == 2)
                    masini[index] = new Coupe();
                else
                    masini[index] = new Mini();

            masini[index].set_nume(m.get_nume());
            masini[index].set_culoare(m.get_culoare());
            masini[index].set_dimensiuni(m.get_dimensiuni());
            masini[index].set_dotari(m.get_dotari());
            masini[index].set_motorizare(m.get_motorizare());
            masini[index].set_transmisie(m.get_transmisie());
*/
        }

        private Lista_Masini()
        {
            masini = new List<Masina>(100);
        }

        public static Lista_Masini getInstance()
        {
             instance = new Lista_Masini();
             return instance;
        }
        public void stergere_masina(string nume)
        {
          
                    if( Convert.ToBoolean (masini.RemoveAll (m => m.get_nume() == nume)))
                    Console.WriteLine("Masina cu numele {0} a fost stearsa", nume);
                        else
                    Console.WriteLine("Nu exista acest nume in lista clientului de masini");
            
        }
        
        public void afisare()
        {
            foreach (Masina m in masini)
            {
                Console.WriteLine("==========================");
                m.afisare_masina();
                Console.WriteLine("==========================");
            }
        }
    }
}
